package collection;

import java.util.ArrayList;
import java.util.Collection;

/**
 * @author 老安
 * @data 2022/6/30 20:48
 */
public class CollectionDemo3 {
    public static void main(String[] args) {
        Collection c = new ArrayList();
        Point p = new Point(1, 2);
        c.add(p);//将元素p存储到集合中
        System.out.println("p:"+p);//(1,2)
        System.out.println("c:"+c);//[(1,2)]

        p.setX(2);//将p对象中的x属性值改为2
        System.out.println("p:"+p);//(2,2)
        System.out.println("c:"+c);//[(2,2)]
    }
}
